package com.clqteam.daoimpl;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;

import com.clqteam.dao.UpdateSupplierDao;
import com.clqteam.util.JDBCutil;

public class UpdateSupplierDaoImpl implements UpdateSupplierDao{
	/**
	 * 供应商信息修改功能的方法
	 * @param supName 供应商名称
	 * @param supContacts 供应商联系人
	 * @param supPhone 供应商联系人电话
	 * @param eId 超市负责人对应的编码
	 * @return
	 */
	@Override
	public boolean updateSupplierBySupId(String supName, String supContacts, String supPhone, int eId, int supId) {
		boolean bl=false;
		StringBuffer sql=new StringBuffer("");
		sql.append(" UPDATE s_supplier SET s_supplier.supName=?,s_supplier.supContacts=?,s_supplier.supPhone=?,s_supplier.eId=?");
		sql.append(" WHERE s_supplier.supId=?");
		Connection con=JDBCutil.getConnection();
		try {
			PreparedStatement ps=con.prepareStatement(sql.toString());			
			ps.setString(1, supName);
			ps.setString(2, supContacts);
			ps.setString(3, supPhone);
			ps.setInt(4, eId);
			ps.setInt(5, supId);
			int i=ps.executeUpdate();
			if(i>0){
				bl=true;
			}
			
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return bl;
	}

	

}
